-- kill_recover
-- created by panyl
-- 击杀敌人增加属性N

return {
    apply = function(prop, baseValue)
        local v = math.modf(baseValue * prop[3] / 1000);
        return baseValue + v;
    end,

    -- 击杀触发
    trigger = function(who, prop, arg)
        local attrib = prop[2];
        local v = prop[3];
        local max;
        
        -- 暂时只有hp和mp
        
        if attrib == "hp" then
            max = who:getMaxHp();
        elseif attrib == "mp" then
            max = who:getMp();
        end
        
        if not max or max <= 0 then
            return false;
        end

        -- 千分比恢复
        v = math.modf(max * value / 1000);

        BonusM.doBonus({ 2, attrib, v, }, "prop kill_recover");

        return v;
    end,

    record = function(target, prop, path)
        return false;
    end 
};